﻿<%@  Title="" Language="C#" MasterPageFile="~/Admin/ContentFrame.master" AutoEventWireup="true" CodeBehind="ProfitRuleTiers.aspx.cs" Inherits="ETD.WebManagement.Admin.OrganizationManage.ProfitRuleTiers" %>

<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <telerik:RadAjaxLoadingPanel ID="loadingPanel" runat="server">
    </telerik:RadAjaxLoadingPanel>
    <telerik:RadAjaxManager runat="server" ID="RadAjaxManagerDefault">
        <AjaxSettings>
            <telerik:AjaxSetting AjaxControlID="btnSearch">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="searchPanel" />
                    <telerik:AjaxUpdatedControl ControlID="rgProfitRuleTiers" LoadingPanelID="loadingPanel" />
                </UpdatedControls>
            </telerik:AjaxSetting>
            <telerik:AjaxSetting AjaxControlID="rgProfitRuleTiers">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="rgProfitRuleTiers" LoadingPanelID="loadingPanel" />
                </UpdatedControls>
            </telerik:AjaxSetting>

        </AjaxSettings>
    </telerik:RadAjaxManager>

    <asp:Panel ID="SearchPanel" runat="server">
        <telerik:RadDockLayout ID="SearchRadDockLayout" runat="server">
            <telerik:RadDockZone ID="SearchRadDockZone" runat="server" Orientation="Vertical" BorderWidth="0"
                Resizable="true">
                <telerik:RadDock ID="SearchRadDock" runat="server" Title="操作：" EnableDrag="false"
                    DockHandle="TitleBar" DockMode="Docked" EnableAnimation="true" EnableRoundedCorners="false">
                    <ContentTemplate>
                        <div class="searchPanel">
                            <div>
                                <telerik:RadButton runat="server" ID="btnCancel" OnClick="btnCancel_Click" Text="取消变更"></telerik:RadButton>
                            </div>
                            <div>
                                <telerik:RadButton runat="server" ID="btnOk" OnClick="btnOk_Click" Text="提交变更"></telerik:RadButton>
                            </div>
                        </div>

                    </ContentTemplate>
                </telerik:RadDock>
            </telerik:RadDockZone>
        </telerik:RadDockLayout>
        <div style="height: 10px;"></div>
    </asp:Panel>


    <telerik:RadGrid ID="rgProfitRuleTiers" runat="server" GridLines="None" AllowPaging="True" AllowCustomPaging="True"
        AllowSorting="True" AutoGenerateColumns="False" ShowStatusBar="True" AllowFilteringByColumn="False"
        OnNeedDataSource="rgProfitRuleTiers_NeedDataSource" OnUpdateCommand="rgProfitRuleTiers_UpdateCommand"
        OnItemCreated="rgProfitRuleTiers_ItemCreated"
        OnItemCommand="rgProfitRuleTiers_ItemCommand"
        OnInsertCommand="rgProfitRuleTiers_InsertCommand" OnDeleteCommand="rgProfitRuleTiers_DeleteCommand"
        OnPageIndexChanged="rgProfitRuleTiers_PageIndexChanged" OnPageSizeChanged="rgProfitRuleTiers_PageSizeChanged"
        ShowFooter="False" ShowHeader="true" GroupingSettings-CaseSensitive="false" AllowMultiRowSelection="false">
        <ClientSettings EnableRowHoverStyle="true">
            <Selecting AllowRowSelect="True"></Selecting>
            <ClientEvents OnCommand="rgProfitRuleTiersOnCommand" />

        </ClientSettings>


        <MasterTableView Font-Size="12px" Width="100%" CommandItemDisplay="Top" ItemStyle-HorizontalAlign="Left"
            PagerStyle-AlwaysVisible="true" AlternatingItemStyle-HorizontalAlign="Left"
            PagerStyle-ProfitRuleTier="Bottom" ClientDataKeyNames="OrganizationID"
            DataKeyNames="OrganizationID"
            PageSize="1000">
            <Columns>

                <telerik:GridBoundColumn UniqueName="OrganizationName" HeaderText="机构名称" DataField="OrganizationName">
                    <ItemStyle Width="300" />
                    <HeaderStyle Width="300" />
                </telerik:GridBoundColumn>
                <telerik:GridBoundColumn UniqueName="Percentage" HeaderText="占比" DataField="Percentage" DataFormatString="{0:f2}">
                    <ItemStyle Width="50" />
                    <HeaderStyle Width="50" />
                </telerik:GridBoundColumn>
                <telerik:GridBoundColumn UniqueName="Remark" HeaderText="备注" DataField="Remark">
                </telerik:GridBoundColumn>
                <telerik:GridTemplateColumn HeaderText="操作" UniqueName="txtColDescription" ItemStyle-Width="120" HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Left">
                    <ItemTemplate>
                        <a class="gridActionButton" onclick="rgProfitRuleTiersOnEditCommand('<%#Eval("OrganizationID").ToString() %>','<%#Eval("ProfitRuleTierID").ToString() %>');">编辑</a>
                        <a class="gridActionButton" onclick="rgProfitRuleTiersOnDeleteCommand(this,'<%#Eval("ProfitRuleTierID").ToString() %>');">删除</a>
                        <asp:Button ID="lbtnDeleteHiden" CssClass="hidden" runat="server" CommandName="Delete" />
                    </ItemTemplate>
                </telerik:GridTemplateColumn>
            </Columns>
        </MasterTableView>
    </telerik:RadGrid>

    <telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">
        <script type="text/javascript">
            var ProfitRuleTierEditPageUrl = '<%=ResolveClientUrl("/Admin/OrganizationManage/ProfitRuleTierEdit.aspx") %>';
            var rgProfitRuleTiers = null;
            $(document).ready(function () {
                rgProfitRuleTiers = $find('<%=rgProfitRuleTiers.ClientID %>');
            });



            function rgProfitRuleTiersOnCommand(sender, eventArgs) {
                //retrieve the current commandName and commandArgument
                var commandName = eventArgs.get_commandName();
                if (commandName == "InitInsert") {
                    rgProfitRuleTiersOnInsertCommand(eventArgs);
                }
                else if (commandName == "Edit") {

                }

                //eventArgs.set_cancel(true); //cancel the command
            }
            function rgProfitRuleTiersOnInsertCommand(eventArgs) {
                var addUrl = ProfitRuleTierEditPageUrl + "?BelongToOrganizationID=<% =this.OrganizationID %>&OrganizationID=" + 0 + "&ProfitRuleTierID=";
                DefaultWindow.openWindow('添加', addUrl, 800, 500);
                eventArgs.set_cancel(true);
            }
            function rgProfitRuleTiersOnEditCommand(OrganizationID, ProfitRuleTierID) {
                var editUrl = ProfitRuleTierEditPageUrl + "?BelongToOrganizationID=<% =this.OrganizationID %>&OrganizationID=" + OrganizationID + "&ProfitRuleTierID=" + ProfitRuleTierID
                DefaultWindow.openWindow('编辑', editUrl, 800, 500);
            }
            function rgProfitRuleTiersOnDeleteCommand(self, ProfitRuleTierID) {
                onDeleteRadconfirm('确定要删除吗？', function (arg) {
                    if (arg) {
                        $(self).next().click();
                    }
                });
            }

            function refreshPageWithState() {
                var grid = rgProfitRuleTiers.get_masterTableView();
                grid.rebind();
            }

        </script>

    </telerik:RadCodeBlock>
</asp:Content>


